home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC / src / wcedll.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  2.1 KB  |  77 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10.  
  11. #include "stdafx.h"
  12.  
  13. #ifdef _DEBUG
  14. #undef THIS_FILE
  15. static char THIS_FILE[] = __FILE__;
  16. #endif
  17.  
  18. #define new DEBUG_NEW
  19.  
  20. #if (_WIN32_WCE == 201)
  21. // WinCE: This file provides the MFCCE-compatible _DllMainCRTStartup for WinCE 2.01 builds,
  22. //        including Palm-Sized PC.
  23.  
  24. extern "C" void __cdecl _cinit(void);
  25. extern "C" void __cdecl _cexit(void);
  26.  
  27. #if defined(_AFXDLL)
  28. extern "C" BOOL (WINAPI* _pRawDllMain)(HINSTANCE, DWORD, LPVOID);
  29. #else
  30. extern "C" BOOL (WINAPI* _pRawDllMain)(HINSTANCE, DWORD, LPVOID) = NULL;
  31. #endif
  32.  
  33. extern "C" BOOL WINAPI DllMain(HANDLE, DWORD, LPVOID);
  34.  
  35. extern "C" BOOL __stdcall _DllMainCRTStartup(HINSTANCE hDllHandle, DWORD dwReason, LPVOID lpreserved) 
  36. {
  37.     BOOL retcode = TRUE;
  38.  
  39.     if (dwReason == DLL_PROCESS_ATTACH)
  40.     {
  41.         if ( retcode && _pRawDllMain )
  42.             retcode = (*_pRawDllMain)(hDllHandle, dwReason, lpreserved);
  43.  
  44.         if ( retcode )
  45.             _cinit();
  46.     }
  47.     
  48.     if (retcode)
  49.         retcode = DllMain((HANDLE)hDllHandle, dwReason, lpreserved);
  50.     
  51.     if (dwReason == DLL_PROCESS_DETACH)
  52.     {
  53.         _cexit();
  54.         if ( _pRawDllMain )
  55.         {
  56.             if( (*_pRawDllMain)(hDllHandle, dwReason, lpreserved) == FALSE )
  57.                 retcode = FALSE;
  58.         }
  59.     }
  60.     return retcode;
  61. }
  62.  
  63. // For _USRDLL builds, we need an alternative entry point because the linker is going to favor the 
  64. // one in corelibc.lib.
  65. extern "C" BOOL __stdcall wce_DllMainCRTStartup(HINSTANCE hDllHandle, DWORD dwReason, LPVOID lpreserved) 
  66. {
  67.     return _DllMainCRTStartup(hDllHandle, dwReason, lpreserved);
  68. }
  69.  
  70. #if defined(_X86_) || defined(SHx) || defined(x86)
  71. extern "C" { int _wce_afxForceUSRDLL; }
  72. #else
  73. extern "C" { int __wce_afxForceUSRDLL; }
  74. #endif
  75.  
  76. #endif // _WIN32_WCE
  77.